<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>简化对象写法</title>
</head>
<body>
    <script>
        // ES6允许再打括号里面直接写入变量和函数,作为对象的属性和方法
        let name = '刘亦菲';
        let ins = function(){
            console.log('是美女');
        }

        const girl = {
            name,//等价于name:name
            ins,
            func(){//等价于function:func(){};
                console.log('ES6func');
            }
        }
        console.log(girl);
    </script>
</body>
</html>